import request from '@/utils/request'

// 查询商品详情列表
export function listT_product(query) {
  return request({
    url: '/backend/t_product/list',
    method: 'get',
    params: query
  })
}

// 查询商品详情详细
export function getT_product(id) {
  return request({
    url: '/backend/t_product/' + id,
    method: 'get'
  })
}

// 新增商品详情
export function addT_product(data) {
  return request({
    url: '/backend/t_product',
    method: 'post',
    data: data
  })
}

// 修改商品详情
export function updateT_product(data) {
  return request({
    url: '/backend/t_product',
    method: 'put',
    data: data
  })
}

// 删除商品详情
export function delT_product(id) {
  return request({
    url: '/backend/t_product/' + id,
    method: 'delete'
  })
}

// 修改商品状态
export function changeIsUsable(id, isUsable) {
  const data = {
    id,
    isUsable
  }
  return request({
    url: '/backend/t_product/changeIsUsable',
    method: 'put',
    data: data
  })
}
